package com.fr.base;

import java.lang.reflect.Field;
import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class ReflectionUtils
{
  public static boolean setPrivateFieldValue(Object paramObject1, String paramString, Object paramObject2)
  {
    Class localClass = paramObject1.getClass();
    if (!(localClass.equals(Object.class)))
      try
      {
        Field localField = localClass.getDeclaredField(paramString);
        localField.setAccessible(true);
        localField.set(paramObject1, paramObject2);
      }
      catch (NoSuchFieldException localNoSuchFieldException)
      {
        while (true)
        {
          localClass = localClass.getSuperclass();
          if (localClass.equals(Object.class))
          {
            FRContext.getLogger().log(Level.WARNING, localNoSuchFieldException.getMessage(), localNoSuchFieldException);
            return false;
          }
        }
      }
      catch (IllegalAccessException localIllegalAccessException)
      {
        FRContext.getLogger().log(Level.WARNING, localIllegalAccessException.getMessage(), localIllegalAccessException);
        return false;
      }
    return true;
  }

  public static Object getPrivateFieldValue(Object paramObject, String paramString)
  {
    Class localClass = paramObject.getClass();
    Object localObject = null;
    if (!(localClass.equals(Object.class)))
      try
      {
        Field localField = localClass.getDeclaredField(paramString);
        localField.setAccessible(true);
        localObject = localField.get(paramObject);
      }
      catch (NoSuchFieldException localNoSuchFieldException)
      {
        while (true)
        {
          localClass = localClass.getSuperclass();
          if (localClass.equals(Object.class))
            FRContext.getLogger().log(Level.WARNING, localNoSuchFieldException.getMessage(), localNoSuchFieldException);
        }
      }
      catch (IllegalAccessException localIllegalAccessException)
      {
        FRContext.getLogger().log(Level.WARNING, localIllegalAccessException.getMessage(), localIllegalAccessException);
      }
    return localObject;
  }
}